# RUN: tf-mlir-translate -graphdef-to-splatted-mlir %s -o - | FileCheck %s

node {
  name: "Const"
  op: "Const"
  attr {
    key: "dtype"
    value {
      type: DT_INT32
    }
  }
  attr {
    key: "value"
    value {
      tensor {
        dtype: DT_INT32
        tensor_shape {
        }
        int_val: 1
      }
    }
  }
}
node {
  name: "Const_1"
  op: "Const"
  attr {
    key: "dtype"
    value {
      type: DT_INT32
    }
  }
  attr {
    key: "value"
    value {
      tensor {
        dtype: DT_INT32
        tensor_shape {
        }
        int_val: 0
      }
    }
  }
}
node {
  name: "indexed_case"
  op: "StatelessCase"
  input: "Const_1"
  input: "Const"
  attr {
    key: "Tin"
    value {
      list {
        type: DT_INT32
      }
    }
  }
  attr {
    key: "Tout"
    value {
      list {
        type: DT_INT32
      }
    }
  }
  attr {
    key: "_lower_using_switch_merge"
    value {
      b: true
    }
  }
  attr {
    key: "_read_only_resource_inputs"
    value {
      list {
      }
    }
  }
  attr {
    key: "branches"
    value {
      list {
        func {
          name: "indexed_case_branch0_4"
        }
        func {
          name: "indexed_case_branch1_5"
        }
      }
    }
  }
  attr {
    key: "output_shapes"
    value {
      list {
        shape {
        }
      }
    }
  }
}
node {
  name: "indexed_case/Identity"
  op: "Identity"
  input: "indexed_case"
  attr {
    key: "T"
    value {
      type: DT_INT32
    }
  }
}
library {
  function {
    signature {
      name: "indexed_case_branch0_4"
      input_arg {
        name: "add_const"
        type: DT_INT32
      }
      output_arg {
        name: "add"
        type: DT_INT32
      }
    }
    node_def {
      name: "add/y"
      op: "Const"
      attr {
        key: "dtype"
        value {
          type: DT_INT32
        }
      }
      attr {
        key: "value"
        value {
          tensor {
            dtype: DT_INT32
            tensor_shape {
            }
            int_val: 1
          }
        }
      }
      experimental_debug_info {
        original_node_names: "add/y"
      }
    }
    node_def {
      name: "add_0"
      op: "AddV2"
      input: "add_const"
      input: "add/y:output:0"
      attr {
        key: "T"
        value {
          type: DT_INT32
        }
      }
      experimental_debug_info {
        original_node_names: "add"
      }
    }
    ret {
      key: "add"
      value: "add_0:z:0"
    }
    arg_attr {
      key: 0
      value {
        attr {
          key: "_output_shapes"
          value {
            list {
              shape {
              }
            }
          }
        }
      }
    }
  }
  function {
    signature {
      name: "indexed_case_branch1_5"
      input_arg {
        name: "add_const"
        type: DT_INT32
      }
      output_arg {
        name: "add"
        type: DT_INT32
      }
    }
    node_def {
      name: "add/y"
      op: "Const"
      attr {
        key: "dtype"
        value {
          type: DT_INT32
        }
      }
      attr {
        key: "value"
        value {
          tensor {
            dtype: DT_INT32
            tensor_shape {
            }
            int_val: 2
          }
        }
      }
      experimental_debug_info {
        original_node_names: "add/y"
      }
    }
    node_def {
      name: "add_0"
      op: "AddV2"
      input: "add_const"
      input: "add/y:output:0"
      attr {
        key: "T"
        value {
          type: DT_INT32
        }
      }
      experimental_debug_info {
        original_node_names: "add"
      }
    }
    ret {
      key: "add"
      value: "add_0:z:0"
    }
    arg_attr {
      key: 0
      value {
        attr {
          key: "_output_shapes"
          value {
            list {
              shape {
              }
            }
          }
        }
      }
    }
  }
}
versions {
  producer: 486
  min_consumer: 12
}

# CHECK: tf.Case
# CHECK-SAME: is_stateless
